package com.dorm.cj.thread;

public class MyThread {
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            try {
                Thread.sleep(10L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        thread.start();
        String name = thread.getName();
        System.out.println("name:" + name);
        ClassLoader contextClassLoader = thread.getContextClassLoader();
        System.out.println("contextClassLoader:" + contextClassLoader);
        long id = thread.getId();
        System.out.println("id:" + id);
        int priority = thread.getPriority();
        System.out.println("priority:" + priority);
        StackTraceElement[] stackTrace = thread.getStackTrace();
        System.out.println("stackTrace:" + stackTrace);
        Thread.State state = thread.getState();
        System.out.println("state:" + state.name());
        boolean alive = thread.isAlive();
        System.out.println("isAlive:" + alive);
        boolean daemon = thread.isDaemon();
        System.out.println("isDaemon:" + daemon);
        thread.interrupt();
        boolean interrupted = thread.isInterrupted();
        System.out.println("isInterrupted:" + interrupted);
        thread.checkAccess();
    }
}
